/**
问题1：是否需合并单个、组合
问题2：是否需调整出参
问题3：浮动条件是否内部实现或代码实现
/**

/** 单个命中 **/

Integer value = 5;

/** 生命体征相关 **/
if (null != source.vitalSign) {

    /** 意识 **/
    if(null != source.vitalSign.consciousness){
        if (source.vitalSign.consciousness == 'V') {
            value = 2 < value ? 2 : value;
        } else if (source.vitalSign.consciousness == 'P') {
            /** 成人[14,200)岁 I级，儿童[0,14)岁，II级 **/
            if (null != source.disease && null != source.disease.patientType && source.disease.patientType == 2) {
                value = 1 < value? 1 : value;
            } else {
                value = 2 < value ? 2 : value;
            }
        } else if (source.vitalSign.consciousness == 'U') {
            value = 1 < value ? 1 : value;
        }
    }
    /** 呼吸 **/
    if(null != source.vitalSign.breathe){
        if (source.vitalSign.breathe >= 0 && source.vitalSign.breathe <= 9) {
                if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
                    value = Math.min(value,#{level});
                }
        }
        if (source.vitalSign.breathe <= 0 || source.vitalSign.breathe > 50) {
            if (null != source.disease && null != source.disease.age && source.disease.age < 0.25) {
                value = Math.min(value,#{level});
            }
        }
        if (source.vitalSign.breathe <= 0 || source.vitalSign.breathe > 40) {
            if (null != source.disease  && null != source.disease.age && (source.disease.age > 0.25 && source.disease.age <= 3)) {
                value = Math.min(value,#{level});
            }
        }
        if (source.vitalSign.breathe <= 0 || source.vitalSign.breathe > 30) {
            if (null != source.disease  && null != source.disease.age && (source.disease.age >= 4 && source.disease.age <= 8)) {
                value = Math.min(value,#{level});
            }
        }
        if (source.vitalSign.breathe <= 0 || source.vitalSign.breathe > 20) {
            if (null != source.disease  && null != source.disease.age && (source.disease.age >= 9 && source.disease.age < 14)) {
                value = Math.min(value,#{level});
            }
        }
    }

    /** 血氧饱和度 **/
    if(null != source.vitalSign.bloodOxygenSaturation){
         if (source.vitalSign.bloodOxygenSaturation < 90) {
             if (null != source.disease && null != source.disease.patientType && source.disease.patientType == 1) {
                 value = 1 < value ? 1 : value;
             }
         }
         if (source.vitalSign.bloodOxygenSaturation >= 90 && source.vitalSign.bloodOxygenSaturation < 95) {
             if (null != source.disease && null != source.disease.patientType && source.disease.patientType == 1) {
                 value = 2 < value ? 2 : value;
             }
         }
    }

    /** 脉搏 **/
    if(null != source.vitalSign.pulse){
        if (source.vitalSign.pulse <= 0) {
            if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
                value = 1 < value ? 1 : value;
            }
        }
        if ((source.vitalSign.pulse > 140) || (source.vitalSign.pulse > 0 && source.vitalSign.pulse < 50)) {
            if (null != source.disease && null != source.disease.patientType && source.disease.patientType == 2) {
                value = 2 < value ? 2 : value;
            }
        }
        if (source.vitalSign.pulse >= 121 && source.vitalSign.pulse <= 140) {
            if (null != source.disease && null != source.disease.patientType && source.disease.patientType == 2) {
                value = 3 < value ? 3 : value;
            }
        }
        if ((source.vitalSign.pulse >= 0 && source.vitalSign.pulse <= 79) || (source.vitalSign.pulse > 180)) {
            if (null != source.disease && null != source.disease.age && (source.disease.age >= 0 && source.disease.age <= 2)) {
                value = 1 < value ? 1 : value;
            }
        }
        if ((source.vitalSign.pulse >= 0 && source.vitalSign.pulse <= 59) || (source.vitalSign.pulse > 160)) {
            if (null != source.disease && null != source.disease.patientType && source.disease.patientType == 1) {
                value = 1 < value ? 1 : value;
            }
        }
    }

    /** 血压-收缩压 **/
    if(null != source.vitalSign.systolicPressure){
        if (source.vitalSign.systolicPressure <= 0) {
            if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
                value = 1 < value ? 1 : value;
            }
        }
        if (source.vitalSign.systolicPressure >= 120) {
            if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
                value = 4 < value ? 4 : value;
            }
        }
        if (source.vitalSign.systolicPressure >= 90 && source.vitalSign.systolicPressure < 120) {
            if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
                value = 5<value?5:value;
            }
        }
    }

    /** 血压-舒张压 **/
    if(null != source.vitalSign.diastolicPressure){
        if (source.vitalSign.diastolicPressure <= 0) {
             if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2  || source.disease.patientType == 4)) {
                value = 1 < value ? 1: value;
             }
         }
         if (source.vitalSign.diastolicPressure >= 120) {
             if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
                value = 4 < value ? 4 : value;
             }
         }
    }

    /** 体温 **/
    if(null != source.vitalSign.temperature){
        if (source.vitalSign.temperature > 41 || source.vitalSign.temperature < 35) {
            /**成人老人和儿童**/
            if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4 || source.disease.patientType == 1)) {
                value = 1 < value ? 1 : value;
            }
        }
        if (source.vitalSign.temperature > 39 && source.vitalSign.temperature <= 41) {
            /**成人老人和儿童**/
            if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4 || source.disease.patientType == 1)) {
                value = 4 < value ? 4 : value;
            }
        }
    }

    /** 血糖 **/
    if (null != source.vitalSign.bloodSugar && source.vitalSign.bloodSugar < 3) {
        if (null != source.disease && null != source.disease.patientType && source.disease.patientType == 1) {
            value = 1 < value ? 1 : value;
        }
    }
}

/** 创伤评分相关 **/
if (null != source.wound) {
    if (source.wound.score != null && source.wound.score >= 3 && source.wound.score <= 10) {
            value = 1 < value ? 1 : value;
    } else if (source.wound.score != null && source.wound.score >= 11 && source.wound.score <= 13) {
            value = 2 < value ? 2 : value;
    }
}

/** 组合命中 **/
if (null != source.vitalSign) {

    if (source.vitalSign.breathe != null && source.vitalSign.breathe > 20 && source.vitalSign.systolicPressure != null && source.vitalSign.systolicPressure >= 220) {
        if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
            value = 2 < value ? 2 : value;
        }
    }

    if (source.vitalSign.pulse != null && source.vitalSign.pulse > 140 && source.vitalSign.systolicPressure != null && source.vitalSign.systolicPressure < 90) {
        if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
            value = 1 < value ? 1 : value;
        }
    }

    if (source.vitalSign.pulse != null && source.vitalSign.pulse < 50 && source.vitalSign.systolicPressure != null && source.vitalSign.systolicPressure < 90) {
        if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
            value = 1 < value ? 1 : value;
        }
    }

    if (source.vitalSign.breathe != null && source.vitalSign.breathe > 20 && source.vitalSign.diastolicPressure != null && source.vitalSign.diastolicPressure >= 120) {
        if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
            value = 2 < value ? 2 : value;
        }
    }

    if (source.vitalSign.temperature != null && source.vitalSign.temperature > 37.5 && source.disease.pastHistory != null && source.disease.pastHistory.contains('肾移植')) {
        if (null != source.disease && null != source.disease.patientType && (source.disease.patientType == 2 || source.disease.patientType == 4)) {
            value = 3 < value ? 3 : value;
        }
    }

    return value;

}
